/**
 * 
 */
package switchviz.gui;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import java.awt.Frame;
import java.awt.BorderLayout;
import javax.swing.JDialog;

import switchviz.Application;

import java.awt.Dimension;

/**
 * @author Thomas
 *
 */
public class AboutDialog extends JDialog
{
	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;
	private JPanel monkeyPanel = null;
	private JLabel versionLabel = null;

	/**
	 * @param owner
	 */
	public AboutDialog(Frame owner)
	{
		super(owner);
		
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize()
	{
		this.setSize(400, 300);
		this.setPreferredSize(new Dimension(400, 300));
		this.setTitle("About");
		this.setContentPane(getJContentPane());
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane()
	{
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
			jContentPane.add(getMonkeyPanel(), BorderLayout.CENTER);
			jContentPane.add(getVersionLabel(), BorderLayout.SOUTH);
		}
		
		return jContentPane;
	}
	
	private JPanel getMonkeyPanel()
	{
		if (monkeyPanel == null) {
			monkeyPanel = new JPanel();
			monkeyPanel.setLayout(new BorderLayout());
			JLabel lblTitle = new JLabel("created by");
			lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
			JLabel lblimg = new JLabel("", new ImageIcon("./images/three_monkeys.jpg"), JLabel.CENTER);
			JLabel lblAuthor = new JLabel("Thomas Otterbein & Daniel Scheidle & Hanno Fallmann");
			lblAuthor.setHorizontalAlignment(SwingConstants.CENTER);
			monkeyPanel.add(lblTitle, BorderLayout.NORTH);
			monkeyPanel.add(lblimg, BorderLayout.CENTER);
			monkeyPanel.add(lblAuthor, BorderLayout.SOUTH);
		}
		
		return monkeyPanel;
	}

	/**
	 * This method initializes aboutVersionLabel	
	 * 	
	 * @return javax.swing.JLabel	
	 */
	private JLabel getVersionLabel()
	{
		if (versionLabel == null)
		{
			versionLabel = new JLabel();
			versionLabel.setText("Version " + Application.getVersion());
			versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
		}
		
		return versionLabel;
	}	
}
